export function timeStr() {
	const date = new Date()
	const hour = String(date.getHours()).padStart(2, '0')
	const minute = String(date.getMinutes()).padStart(2, '0')
	const second = String(date.getSeconds()).padStart(2, '0')

	return `${hour}:${minute}:${second}`
}

export function dateStr() {
	const date = new Date()
	const year = date.getFullYear()
	const month = String(date.getMonth() + 1).padStart(2, '0')
	const day = String(date.getDate()).padStart(2, '0')
	const week = date.getDay()

	return `${year}-${month}-${day} ${weekStr(week)}`
}

function weekStr(num: number) {
	let week = null
	switch (num) {
		case 1:
			week = '星期一'
			break
		case 2:
			week = '星期二'
			break
		case 3:
			week = '星期三'
			break
		case 4:
			week = '星期四'
			break
		case 5:
			week = '星期五'
			break
		case 6:
			week = '星期六'
			break
		default:
			week = '星期日'
	}
	return week
}
